@import './variables.scss';
@import './common.scss';

// Reset CSS
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

// 基础样式
html {
  font-size: $font-size-base;
  -webkit-text-size-adjust: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  font-size: $font-size-base;
  color: $text-primary;
  background-color: var(--bg-color);
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-family: inherit;
}

#app {
  width: 100%;
}

// 移除列表样式
ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

// 移除链接下划线
a {
  text-decoration: none;
  color: inherit;
  outline: none;
  cursor: pointer;
  transition: color $transition-duration;
  
  &:hover {
    color: $primary;
  }
}

// 移除输入框默认样式
input, button, textarea, select {
  border: none;
  outline: none;
  background: none;
  font-family: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}

// 图片默认样式
img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  border-style: none;
}

// 表格默认样式
table {
  border-collapse: collapse;
  border-spacing: 0;
}

// 滚动条样式
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--el-border-color-light);
  border-radius: $border-radius-base;
  transition: background-color $transition-duration;
  
  &:hover {
    background-color: var(--el-border-color);
  }
  
  &:active {
    background-color: var(--el-border-color-dark);
  }
}

::-webkit-scrollbar-track {
  background-color: transparent;
  border-radius: $border-radius-base;
  
  &:hover {
    background-color: var(--el-fill-color-blank);
  }
}

::-webkit-scrollbar-corner {
  background-color: transparent;
}

// 文本选择样式
::selection {
  background: var(--el-color-primary);
  color: var(--el-color-white);
}

// SVG 图标样式
svg {
  vertical-align: middle;
  width: 1em;
  height: 1em;
  fill: currentColor;
  overflow: hidden;
}

// 清除浮动
.clearfix {
  &::after {
    content: '';
    display: table;
    clear: both;
  }
}

// 基础布局
.app-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

// 内容区域
.app-main {
  padding: $spacing-base;
  position: relative;
  overflow: auto;
}

// 页面切换动画
.fade-transform-enter-active,
.fade-transform-leave-active {
  transition: all $transition-duration $transition-timing-function;
}

.fade-transform-enter-from {
  opacity: 0;
  transform: translateX(-$spacing-base);
}

.fade-transform-leave-to {
  opacity: 0;
  transform: translateX($spacing-base);
}

// 全局过渡动画
.fade {
  &-enter-active,
  &-leave-active {
    transition: opacity $animation-duration-base $animation-timing-function-ease;
  }
  
  &-enter-from,
  &-leave-to {
    opacity: 0;
  }
}

.slide-fade {
  &-enter-active {
    transition: all $animation-duration-base $animation-timing-function-ease;
  }
  
  &-leave-active {
    transition: all $animation-duration-fast $animation-timing-function-ease;
  }
  
  &-enter-from,
  &-leave-to {
    transform: translateX(20px);
    opacity: 0;
  }
}

.slide-up {
  &-enter-active {
    transition: all $animation-duration-base $animation-timing-function-bounce;
  }
  
  &-leave-active {
    transition: all $animation-duration-fast $animation-timing-function-ease;
  }
  
  &-enter-from,
  &-leave-to {
    transform: translateY(20px);
    opacity: 0;
  }
}

.zoom {
  &-enter-active,
  &-leave-active {
    transition: all $animation-duration-base $animation-timing-function-spring;
  }
  
  &-enter-from,
  &-leave-to {
    transform: scale(0.95);
    opacity: 0;
  }
}

.bounce {
  &-enter-active {
    animation: bounce-in $animation-duration-base $animation-timing-function-bounce;
  }
  
  &-leave-active {
    animation: bounce-out $animation-duration-fast $animation-timing-function-ease;
  }
}

@keyframes bounce-in {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes bounce-out {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.3);
    opacity: 0;
  }
}

// 移动端适配
@include respond-to(xs) {
  html {
    font-size: 14px;
  }
  
  body {
    -webkit-overflow-scrolling: touch;
  }
  
  .app-main {
    padding: $spacing-sm;
  }
  
  // 优化移动端点击延迟
  * {
    touch-action: manipulation;
  }
  
  // 优化移动端选择
  ::selection {
    background: rgba(var(--el-color-primary), 0.7);
  }
  
  // 禁用移动端长按菜单
  img, a {
    -webkit-touch-callout: none;
  }
} 